package com.ncdnapp.core.tracer;

import lombok.Getter;

import java.util.UUID;

public class Tracer {
    private Tracer parentTracer;
    @Getter
    private String traceId;
    @Getter
    private String spanId;

    public Tracer(Tracer parentTracer) {
        this.parentTracer = parentTracer;
        if (parentTracer != null) {
            this.traceId = parentTracer.getSpanId();
        } else {
            this.traceId = UUID.randomUUID().toString().replaceAll("-", "");
        }
        this.spanId = UUID.randomUUID().toString().replaceAll("-", "");
    }
}
